/*******************************************************************************
* Purpose: State-level median income in participating states
* 
* Dependencies:
*   Input: FRED series "Real Median Household Income in Arkansas" in 1985 
*		   (in 2020 USD)
*   Output: Stata file with median houshold income in 8 participating states
*		    (medinc.dta)
*
* Notes: -
*******************************************************************************/
set more off
clear all

global storage: env storage

import excel "$storage/ece_parenting/us_1985/fred-median-income.xls", sheet("Annual") firstrow clear
rename * s_*
rename s_DATE DATE
reshape long s_, i(DATE) j(state) string

keep if year(DATE) == 1985 
rename s_ medinc

replace medinc = medinc / 1000

// change state variable for merge
gen site = state
replace site = "ARK" if site == "Arkansas"
replace site = "EIN" if site == "NewYork"  
replace site = "HAR" if site == "Massachusets"
replace site = "MIA" if site == "Florida"  
replace site = "PEN" if site == "Pennsylvania"
replace site = "TEX" if site == "Texas"  
replace site = "WAS" if site == "Washington"  
replace site = "YAL" if site == "Conneticut"  

drop DATE state
drop if site == "US"

rename *, upper

cd $storage/ece_parenting/
capture mkdir "intermediate_data/"
capture mkdir "intermediate_data/us_1985"
save "$storage/ece_parenting/intermediate_data/us_1985/medinc.dta"
